package com.cq.controller;

import com.cq.pojo.*;
import com.cq.service.BannerService;
import com.cq.service.MeetingService;
import com.cq.service.RoleService;
import com.cq.service.UserService;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * @Author: 悠久的苍穹
 * @Date: 2020/6/22 17:54
 * @Description: ${description}
 * @Version: 1.0
 */
@Controller
public class IndexController {

    @Autowired
    BannerService bannerService;
    @Autowired
    UserService userService;
    @Autowired
    MeetingService meetingService;
    @Autowired
    RoleService roleService;


    /**
     * 跳转到首页
     * @return
     */
    @GetMapping("/index")
    public String index(){
        return "index";
    }


//    @GetMapping("/index2")
//    public String console(){
//        return "home/console.html";
//    }



//    @GetMapping("/index3")
//    public String homepage1(){
//        return "home/homepage1.html";
//    }
//
//
//    @GetMapping("/home/homepage2")
//    public String homepage2(){
//        return "home/homepage2.html";
//    }
    /**
     * 跳转到首页
     * @return
     */
    @GetMapping("/console")
    public String console() {
        return "/home/console";
    }
    /**
     * 跳转到文件管理页
     * @return
     */
    @GetMapping("/fileManagement")
    public String fileManagement() {
        return "/set/system/fileManage";
    }
    /**
     * 跳转到登录页
     * @return
     */
    @RequestMapping("/login")
    public String login(){
        return "user/login";
    }
    /**
     * 退出登录
     * @return
     */
    @GetMapping("/logout")
    public String logout() {
        Subject subject = SecurityUtils.getSubject();
        //注销
        subject.logout();
        return "user/login";
    }
    /**
     * 跳转到用户页
     * @return
     */
    @GetMapping("/user/list")
    public String userList(){
        return "user/user/list.html";
    }
    /**
     * 跳转到角色页
     * @return
     */
    @GetMapping("/user/role")
    public String roleList(){
        return "user/administrators/role.html";
    }
    /**
     * 跳转到管理员页
     * @return
     */
    @GetMapping("/user/admin")
    public String adminList(){
        return "user/administrators/list.html";
    }
    /**
     * 跳转到管理员详情页
     * @return
     */
    @GetMapping("/user/info")
    public String setUser(){
        return "set/user/info";
    }
    /**
     * 跳转到管理员修改密码
     * @return
     */
    @GetMapping("/updateAdminPassword")
    public String updateAdminPassword(){
        return "set/user/password";
    }
    /**
     * 跳转到管理员添加页
     * @return
     */
    @GetMapping("/addAdminUI")
    public String addAdminUI(){
        return "user/administrators/adminform";
    }
    /**
     * 跳转到角色添加页
     * @return
     */
    @GetMapping("/addRoleUI")
    public String addRoleUI(){
        return "user/administrators/roleform";
    }
    /**
     * 跳转到广告页
     * @return
     */
    @GetMapping("/bannerList")
    public String banner(Model model){
        List<Banner> bannerList = bannerService.findAllBannerIshow();
        model.addAttribute("banner",bannerList);
        return "app/banner/list";
    }
    /**
     * 跳转到广告轮播图添加页
     * @return
     */
    @GetMapping("/addBannerUI")
    public String addBannerUI(){
        return "app/banner/content";
    }

    /**
     * 跳转到用户认证页
     * @return
     */
    @GetMapping("/userAuth")
    public String userAuth(){
        return "user/user/list";
    }

    /**
     * 跳转到会议列表页
     * @return
     */
    @GetMapping("/meetingList")
    public String meetingList(){
        return "app/meeting/meeting/list";
    }

    /**
     * 跳转到多人直播页
     * @return
     */
    @GetMapping("/webrtc/user")
    public String webrtc(Model model){
        Room room = new Room();
        model.addAttribute("room",room);
        model.addAttribute("a","");
        return "rtmp/webrtc/index";
    }
    /**
     * 跳转到多人直播页
     * @return
     */
    @GetMapping("/webrtcList")
    public String webrtcList(){
        return "rtmp/webrtc/webrtcList";
    }
    /**
     * 跳转到直播页
     * @return
     */
    @GetMapping("/rtmp")
    public String rtmp(){
        return "rtmp/rtmpList";
    }

//    @GetMapping("/rtmp123")
//    public String rtmp123(){
//        return "rtmp/room";
//    }
    /**
     * 跳转到会议热门页
     * @return
     */
    @GetMapping("/recommendMeeting")
    public String recommendMeeting(){
        return "app/recommend/list";
    }
    /**
     * 跳转到话题页
     * @return
     */
    @GetMapping("/topicList")
    public String topic(){
        return "app/topic/topic/list";
    }
    /**
     * 跳转到话题热门页
     * @return
     */
    @GetMapping("/recommendTopic")
    public String recommendTopic(){
        return "app/recommend/topic";
    }
    /**
     * 跳转到话题热门页
     * @return
     */
    @GetMapping("/replyList")
    public String reply(){
        return "app/topic/reply/list";
    }
}
